package com.office.personalOffice.personalInfoQuery.contorller;

import com.office.personalOffice.personalInfoQuery.model.TbStaff;
import com.office.personalOffice.personalInfoQuery.model.TbDept;
import com.office.personalOffice.personalInfoQuery.service.impl.PersonalInfoQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/PersonalInfoQuery")
public class PersonalInfoQueryAction {

    @Autowired
    private PersonalInfoQueryService personalInfoQueryService;

    public PersonalInfoQueryService getPersonalInfoQueryService() {
        return personalInfoQueryService;
    }

    public void setPersonalInfoQueryService(PersonalInfoQueryService personalInfoQueryService) {
        this.personalInfoQueryService = personalInfoQueryService;
    }

    //拿取指定的员工信息
    @ResponseBody
    @RequestMapping("/getStaffInfo")
    public List<TbStaff> getStaffInfo(@RequestBody TbStaff tbStaff){

        return personalInfoQueryService.getStaffInfoByCondition(tbStaff);

    } //拿取指定的员工信息


    //拿取所有的部门信息
    @ResponseBody
    @RequestMapping("/getAllDept")
    public List<TbDept> getAllDept(){

        return personalInfoQueryService.getAllDept();

    }


}
